﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EditManager.aspx.cs" Inherits="IsPay.View.EditManager" %>
<%@ Import Namespace="DataServer.Entities" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>编辑管理员帐户</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap 使用了2的,IE兼容性更好-->
    <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <script src="../Scripts/jquery-1.10.2.min.js"></script>
    <script src="../bootstrap/js/bootstrap.min.js"></script>



    <style type="text/css">
        .auto-style1 {
            width: 78px;
            height: 42px;
        }
        .auto-style2 {
            height: 42px;
        }
    </style>
    <script type="text/javascript">
        function OnModifyUser() {
            var jasonstr = "";
            var tableObj = document.getElementById("usermodifytable");
            var ch = new Array();
            var edittable = [];
            for (var i = 0; i < tableObj.rows.length; i++) {    //遍历Table的所有Row
                var dataRow = {};
                for (var j = 0; j < tableObj.rows[i].cells.length; j++) {   //遍历Row中的每一列
                   
                    var cellv = "";
                    var cnode = tableObj.rows[i].cells[j].getElementsByTagName("input");
                    if (cnode.length > 0) {
                        if (cnode[0].type == "checkbox") {
                            cellv = cnode[0].checked;
                        } else {
                            cellv = cnode[0].value;
                        }
                        
                    } else {
                        cellv= tableObj.rows[i].cells[j].innerText;
                    }
                    if (i == 0) {
                        ch[j] = cellv;
                    } else {
                        dataRow[ch[j]] = cellv;
                    }
                }
                if (i > 0) {
                    if (dataRow.modifyflag||dataRow.deleteflag)
                    edittable.push(dataRow);
                }
                
            }
            jasonstr = JSON.stringify(edittable);
            document.getElementById("updatejason").value = jasonstr;
            document.getElementById("formmodify").submit();
            //setTimeout(function(){ document.getElementById("formquery").submit(); }, 5000);
        }
        
    </script>


    </head>
<body>    
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="span12">
                <form id="formquery" method="post" action="EditManager.aspx?ActionType=query">
                    <table>
                        <tr>
                            <td style="text-align: right" class="auto-style2">用户ID</td>
                            <td class="auto-style2">
                                <input type="text" id="txtsusrid" name="txtsusrid" value="" style="border-color: #000000" /></td>
                            <td style="text-align: right" class="auto-style2">用户名</td>
                            <td class="auto-style2">
                                <input type="text" id="txtsusrname" name='txtsusrname' style="border-color: #000000" value="" /></td>
                            <td class="auto-style1"><label>隐藏失效<input id="ISACTIVE" name="ISACTIVE" type="checkbox"  checked="checked"/></label></td>
                            <td class="auto-style2">
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <button type="submit" class="btn btn-primary" data-toggle="button">查询</button></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
    <div class="container">
        <div class="row-fluid">
            <div class="span12">
                <form id="formmodify" method="post" action="EditManager.aspx?ActionType=modify">
                    <table class="table table-striped" id="usermodifytable">
                        <tr>
                            <th><input type="hidden" name="headcell6" id="headcell6" value="modifyflag" />修改</th>
                            <th><input type="hidden" name="headcell7" id="headcell7" value="deleteflag" />失效</th>
                            <th><input type="hidden" name="headcell1" id="headcell1" value="userid" />用户ID</th>
                            <th><input type="hidden" name="headcell2" id="headcell2" value="username" />用户名</th>
                            <th><input type="hidden" name="headcell3" id="headcell3" value="email" />邮箱</th>
                            <th><input type="hidden" name="headcell4" id="headcell4" value="telephone" />电话</th>
                            <th><input type="hidden" name="headcell5" id="headcell5" value="pwd" />密码</th>
                            

                        </tr>
                        <%if (lsuser.Count() > 0)
                            { int i = 0;%>
                        <%foreach (UserProfile userq in lsuser)
                            {%>
                        <tr>
                            <td>
                                <input   type="checkbox" /></td>
                            <td>
                                <input   type="checkbox" /></td>
                            <td><%=userq.UserId%></td>
                            <td><%=userq.UserName %></td>
                            <td><input type="text" style="border:none;background:transparent" value="<%=userq.Email %>" /></td>
                            <td><input type="text" style="border:none;background:transparent" value="<%=userq.Telephone %>" /></td>
                            <td><input type="password" style="border:none;background:transparent" value="" /></td>
                            
                        </tr>
                        <%i++;
                            } %>
                        <%} %>
                    </table>
                    <div style="height: 20px"></div>
                    <div>
                        <input type="hidden" id="updatejason" name="updatejason" value="" />
                        <button type="button" class="btn btn-primary" data-toggle="button" onclick="OnModifyUser()">提交修改</button></td>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div class="container">
        <div class="row-fluid">
            <div class="span12">

                <form id="formadd" method="post" action="EditManager.aspx?ActionType=addsingle">


                    <table style="width: 100%;" class="table table-striped">
                        <tr>

                            <td style="text-align: right; font-weight: bold">用户ID：</td>
                            <td>
                                <input id="txtuserid" name="txtuserid" type="text" class="ipt"  value="<%=user.UserId %>"/>
                            </td>

                        </tr>
                        <tr>

                            <td style="text-align: right; font-weight: bold">用户名：</td>
                            <td>
                                <input id="txtusername" name="txtusername" type="text"  class="ipt" value="<%=user.UserName %>"/>
                            </td>

                        </tr>
                        <tr>

                            <td style="text-align: right; font-weight: bold">初始密码：</td>
                            <td>
                                <input id="txtusepwd1" name="txtusepwd1" type="password" class="ipt"  />
                            </td>

                        </tr>
                        <tr>

                            <td style="text-align: right; font-weight: bold">确认密码：</td>
                            <td>
                                <input id="txtusepwd2" name="txtusepwd2" type="password"  class="ipt" />
                            </td>

                        </tr>
                        <tr>

                            <td style="text-align: right; font-weight: bold">邮箱：</td>
                            <td>

                                <input id="txtmail" name="txtmail" type="text" class="ipt"  value="<%=user.Email %>"/>
                            </td>

                        </tr>
                        <tr>

                            <td style="text-align: right; font-weight: bold">电话：</td>
                            <td>
                                <input id="txtphone" name="txtphone" type="text" class="ipt"  value="<%=user.Telephone %>"/>
                            </td>

                        </tr>
                        <tr>
                            <td></td>
                            <td>
                                <button type="submit" class="btn btn-primary" data-toggle="button">添加</button>
                                <button type="reset" class="btn btn-primary" data-toggle="button">重置</button>
                            </td>


                        </tr>
                        <tr>
                            <td colspan="2"style="text-align:center; font-weight: bold">
                                <asp:Label ID="lblmsg" runat="server" BackColor="White" ForeColor="Red"></asp:Label>
                            </td>

                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
</body>
</html>
